package com.lsl.im.map;

import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;

import com.amap.mapapi.core.GeoPoint;
import com.amap.mapapi.map.MapView;
import com.amap.mapapi.map.Overlay;
import com.lsl.im.activity.HomeActivity;
import com.lsl.im.common.HandlerWhat;

public class CustomOverlay extends Overlay {
	
	private Activity activityContext;
	
	public CustomOverlay(Activity activityContext){
		this.activityContext = activityContext;
	}
	
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		super.draw(canvas, mapView, shadow);
		Point screenPts = new Point();
		
		mapView.getProjection().toPixels(mapView.getMapCenter(), screenPts);		
		
		//final float radius = pj.metersToEquatorPixels(mLocation.getAccuracy());
		final float radius = mapView.getProjection().metersToEquatorPixels(1000*1);
		
		Paint mCirclePaint = new Paint();
		mCirclePaint.setAntiAlias(true);
		mCirclePaint.setColor(Color.BLUE);
		mCirclePaint.setAlpha(50);
		mCirclePaint.setStyle(Style.FILL);
		
		canvas.drawCircle(screenPts.x, screenPts.y, radius, mCirclePaint);			
	}
	
	@Override
	public boolean onTap(GeoPoint geoPoint, MapView mapView) {
//		Message msg = new Message();
//		msg.what = HandlerWhat.maptap;
//		msg.obj = mapView.getMapCenter();		
//		HomeActivity.handler.sendMessage(msg);
		return super.onTap(geoPoint, mapView);		
	}
	
}